#pragma once

#include <windows.h>
#include <GL/gl.h>

class OpenGLWindow {
public:
	OpenGLWindow();

protected:

	void InitializeWindow(HINSTANCE hInstance, const char *title,
		int x = CW_USEDEFAULT,
		int y = CW_USEDEFAULT,
		int width = CW_USEDEFAULT,
		int height = CW_USEDEFAULT);

	// deltaT is the time in ms between frames
	WPARAM ShowWindow(unsigned int deltaT, int nCmdShow = SW_SHOW);

	virtual void OnUpdate() {}
	
	virtual void OnDisplay() {}

	virtual void OnResize(GLsizei width, GLsizei height) {}

	virtual void OnMouseDown() {}

	virtual void OnKeyDown(char c) {}

	virtual void OnDestroy() {}

private:
	LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

private:
	HWND hWnd;			// handle to window
	UINT_PTR timer;		// handle to timer

private:
	
	static LRESULT CALLBACK StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

	static OpenGLWindow *gsInstance;
};

